package cn.com.tom.util;

public class StringUtils {
    /**
     * 1:把类似于AwardBean转换成award_bean字符串
     *
     * @param string
     * @return
     */
    public static String toLower(String string) {
        if (null == string || "".equals(string)) return string;

        StringBuilder result = new StringBuilder();
        result.append(Character.toLowerCase(string.charAt(0)));
        for (int i = 1; i < string.length(); i++) {
            char verter = string.charAt(i);
            if (Character.isUpperCase(verter)) {
                result.append("_");
            }
            result.append(Character.toLowerCase(verter));
        }

        return result.toString();
    }
}
